//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#include <stdlib.h>

size_t __cdecl _strtowcs(wchar_t *wcs, const char *str)
{
    wchar_t *pBegin = wcs;

    if (wcs == NULL || str == NULL) {
        return 0;
    }

    while (*str) {
        *wcs++ = *str++;
    }
    *wcs = L'\0';

    return wcs - pBegin;
}

size_t __cdecl _wcstostr(char *str, const wchar_t *wcs)
{
    char *pBegin = str;

    if (wcs == NULL || str == NULL) {
        return 0;
    }

    while (*wcs) {
        *str++ = (char)(*wcs++);
    } 
    *str = '\0';

    return str - pBegin;
}
